import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_app/app/modules/home/tabs/main/view.dart';
import 'package:getx_app/app/modules/home/tabs/profile/view.dart';

import '../controllers/home_controller.dart';

class HomeView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetBuilder<HomeController>(
        assignId: true,
        builder: (controller) {
          controller.initPageController();
          return Scaffold(
            body: PageView(
              physics: NeverScrollableScrollPhysics(),
              controller: controller.pageController,
              onPageChanged: controller.onPageChanged,
              children: <Widget>[
                MainPage(),
                ProfilePage(),
              ],
            ),
            bottomNavigationBar: BottomNavigationBar(
              type: BottomNavigationBarType.fixed,
              items: <BottomNavigationBarItem>[
                BottomNavigationBarItem(
                  icon: Icon(Icons.home),
                  label: '',
                ),
                BottomNavigationBarItem(
                  icon: Icon(Icons.person),
                  label: '',
                ),
              ],
              onTap: controller.navigationTapped,
              currentIndex: controller.pageIndex,
            ),
          );
        });
  }
}
